<template>
	
	<div>
		<div style="padding: 10px;"  v-html="article"></div>
	</div>

    
    
    
  
</template>

<script>

import { base64} from 'vux'
export default {
	components: {         
            base64
		},
	data () {
		
	    return {
	      
	      article:'',
	      message_id:this.$route.params.message_id,
	      num:0,
	      access_token:''
	     
	    }
	},
	
	methods:{
		
		//获取详情
	    getDetail(){
	    	  
			this.$store.commit('updateLoadingStatus',true);
			  
	    	this.$http.get(this.$store.state.api + 'message/detail&access_token=' + this.access_token + '&message_id=' + this.message_id)
		    .then((response) => {
		    		
		    console.log(response)
				
				if(response.body.code == 0) {
					
					this.article = response.body.data[0].note
					console.log(this.article)
					
				} else {
					
				}
					
				
				this.$store.commit('updateLoadingStatus',false);		
				
			  }, (response) => {
	             
	             
			  });
	    },
	    
	    //获取地址栏信息
		getUrlStr(name){
	      let reg = new RegExp("(^|\\?|&)" + name + "=([^&]*)(\\s|&|$)","i");
	      if(reg.test(window.location.href)){
	        return unescape(RegExp.$2.replace(/\+/g," "))
	      }
	      return undefined
	    },	
		
		
	},
	
	mounted() {
		
		var access_token = this.getUrlStr('access_token');
           var parentId = this.getUrlStr('parent_id');
           
            if(parentId == undefined){
              parentId = 0;
           }
           
           var uid = this.getUrlStr('uid');
           
           if(parentId.toString().indexOf('?') > 0){
           	 parentId = parentId.split('?')[0];
           }
           
           var locurl = location.href;
           locurl = base64.encode(locurl.split('?')[0]);
           
       
           if(access_token != undefined){
         
              localStorage.setItem("access_token",access_token); 
              localStorage.setItem("parent_id",this.getUrlStr('uid'));


           }
           
            if(localStorage.getItem('access_token') != null){
         
              this.$root.registerjudge();
              this.$root.getShare();
              
            }else{
            	
        	  this.$root.gotoWechat(locurl,parentId);
            }
           
    	   this.access_token = localStorage.getItem('access_token');
		
		console.log(this.message_id)

        this.getDetail();
        
        

  },
  
  beforeMount () {

    
  }
	
	
	
}


</script>

<style>
	
	html,body{
		width: 100%;
	}
	img{
		width: 100%;
	}
	
</style>